package com.minelx.scriptbuilder.script.attribute.function;

import com.minelx.scriptbuilder.script.IVariable;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Params {

	private final List<IVariable> values;

	public Params() {
		values = new ArrayList<>();
	}

	public IVariable at(int at) {
		return values.get(at);
	}

	public void append(IVariable value) {
		values.add(value);
	}

	public void appendAll(List<IVariable> params) {
		this.values.addAll(params);
	}

	public void setFirst(IVariable value) {
		values.add(0, value);
	}

	public List<IVariable> values() {
		return values;
	}

	@Override
	public String toString() {
		return "Params(" + values + ") " + super.toString();
	}

	public static Params of(IVariable... values) {
		Params result = new Params();
		result.appendAll(Arrays.asList(values));
		return result;
	}

	public static Params empty() {
		return of();
	}
}
